package chapter02;

public class Test06_Construct {
    public static void main(String[] args) {
        Teacher t = new Teacher("张三",10);
        t.introduec();
        Teacher t1 = new Teacher("李四",20,"秦皇岛职业技术学院");
        t1.introduec();
    }
}
class Teacher{
    private String name;
    private int age;
    private String school = "河北建材职业技术学院";
    //构造函数 要和类名一致 并且没有返回值 构造函数的修饰方式 基本上都是public
    public Teacher(){
        System.out.println("你好老师");
    }
    //定义一个带参数的构造函数
    public Teacher(String name1,int age1){
        name = name1;
        age = age1;
    }
    public Teacher(String name1,int age1,String school1){
        name = name1;
        age = age1;
        school = school1;
    }
    public void introduec(){
        System.out.println(name);
        System.out.println(age);
        System.out.println(school);
    }
}
